package com.exam.entity;

import com.exam.util.UUIDUtil;

import java.sql.Timestamp;
import java.util.Date;

public class DataForm {
    private Date date;
    private String itemList;
    private String name;
    private int num;

    public static Questionnaire toQuestionnaire(DataForm dataForm){
        Questionnaire questionnaire = new Questionnaire();
        String id = UUIDUtil.getOneUUID();
        Timestamp createTime = new Timestamp(dataForm.getDate().getTime());
        questionnaire.setAnswerTime(createTime);
        questionnaire.setId(id);
        questionnaire.setQuestionName(dataForm.getName());
        questionnaire.setAnswerTotal(dataForm.getNum());
        questionnaire.setQuestionStop("3");
        questionnaire.setQuestionContent(dataForm.getItemList());
        return questionnaire;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public String getItemList() {
        return itemList;
    }

    public void setItemList(String itemList) {
        this.itemList = itemList;
    }

    public int getNum() {
        return num;
    }

    public void setNum(int num) {
        this.num = num;
    }
}
